/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.forms;

import com.bs.SplashViewFrame;
import com.bs.persistencia.EntityManager;
import java.awt.AWTKeyStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.KeyboardFocusManager;
import java.awt.event.KeyEvent;
import java.util.HashSet;
import javax.swing.BorderFactory;
import javax.swing.JPanel;

/**
 *
 * @author Bone
 */
public class DialogoForm extends javax.swing.JDialog {

    private Object bean;
    private EntityManager entityManager = new EntityManager();

    public Object getBean() {
        return bean;
    }

    public void setBean(Object bean) {
        Object old = this.bean;
        this.bean = bean;
        firePropertyChange("bean", old, bean);
    }

    public EntityManager getEntityManager() {
        return entityManager;
    }

    public void setEntityManager(EntityManager entityManager) {
        EntityManager old = this.entityManager;
        this.entityManager = entityManager;
        firePropertyChange("entityManager", old, entityManager);
    }

    public DialogoForm() {
        initComponents();
        JPanel p = new JPanel();
        p.setBorder(BorderFactory.createLineBorder(Color.red));
        setContentPane(p);
    }

    public DialogoForm(Object bean) {
        initComponents();
        HashSet conj = new HashSet(this.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
        conj.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_ENTER, 0));
        this.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, conj);
        Object old = this.bean;
        this.bean = bean;
        firePropertyChange("bean", old, bean);
    }

    @Override
    public void paint(Graphics g) {
        super.paint(g); //To change body of generated methods, choose Tools | Templates.

    }

    @Override
    public void repaint() {
        super.repaint(); //To change body of generated methods, choose Tools | Templates.
        Graphics g = getGraphics();
        g.setColor(Color.red);
        g.drawLine(0, 0, this.getWidth(), 0);
        g.drawLine(0, this.getHeight(), 0, 0);
        g.drawLine(this.getWidth(), 0, 0, 0);
        g.drawLine(0, 0, 0, this.getHeight());
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setIconImage(SplashViewFrame.getIconeAplicacao());
        setModal(true);
        setUndecorated(true);
        getContentPane().setLayout(new java.awt.CardLayout());

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
